home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 30
/
Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso
/
Aminet
/
util
/
wb
/
DockNet20_src.lha
/
DOCKNETPrefs.E
< prev
Wrap
Text File
|
1998-10-14
|
9KB
|
306 lines
/* Start of DockNet */
OPT PREPROCESS
#define STR [256]:STRING
MODULE 'utility/tagitem','dos/dos'
MODULE 'libraries/gadtools'
MODULE'muimaster','libraries/mui','libraries/muip','mui/muicustomclass','amigalib/boopsi','intuition/classes','intuition/classusr','intuition/screens','intuition/intuition'
MODULE'tools/boopsi'
MODULE'utility/hooks'
ENUM NULL, ID_SAVEPREFS, ID_USEPREFS
DEF app,sigs,wi_label_0,running,result,file,btsave,btuse,btcancel,pop1,pop2,pop3,pop4,pop5,pop6,pop7,pop8,pop9,str1,str2,str3,str4,str5,str6,str7,str8,str9,pg1 STR,pg1p STR,pg2 STR,pg2p STR,pg3 STR,pg3p STR,pg4 STR,pg4p STR,pg5 STR,pg5p STR,pg6 STR,pg6p STR,pg7 STR,pg7p STR,pg8 STR,pg8p STR,pg9 STR,pg9p STR
PROC main() HANDLE
/*
DEFINIR VARs DA GUI COM DEF ... E TB OUTRAS VARs
*/
file := Open('env:Docknet/DockNet.prefs', OLDFILE)
ReadStr(file,pg1)
ReadStr(file,pg1p)
ReadStr(file,pg2)
ReadStr(file,pg2p)
ReadStr(file,pg3)
ReadStr(file,pg3p)
ReadStr(file,pg4)
ReadStr(file,pg4p)
ReadStr(file,pg5)
ReadStr(file,pg5p)
ReadStr(file,pg6)
ReadStr(file,pg6p)
ReadStr(file,pg7)
ReadStr(file,pg7p)
ReadStr(file,pg8)
ReadStr(file,pg8p)
ReadStr(file,pg9)
ReadStr(file,pg9p)
Close(file)
IF (muimasterbase:=OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))=NIL THEN
Raise('Failed to open muimaster.library')
app := ApplicationObject,
MUIA_Application_Author, 'Luis Domingos',
MUIA_Application_Base, 'DockNetPrefs',
MUIA_Application_Version, '$VER: DockNetPrefs 01.70 (26.07.98)',
MUIA_Application_Copyright, 'c1998 Luis Domingos',
MUIA_Application_Description, 'DockNet Prefs',
SubWindow, wi_label_0:=WindowObject,
MUIA_Window_Title, 'DockNet',
MUIA_Window_ID, "0WIN",
MUIA_Window_SizeGadget, 1,
WindowContents, VGroup,
Child,HGroup,
Child, VGroup,
MUIA_FrameTitle, 'Names for the Buttons',
Child, str1 := StringObject,
StringFrame,
MUIA_String_Contents, pg1, End,
Child, str2 := StringObject,
StringFrame,
MUIA_String_Contents, pg2, End,
Child, str3 := StringObject,
StringFrame,
MUIA_String_Contents, pg3, End,
Child, str4 := StringObject,
StringFrame,
MUIA_String_Contents, pg4, End,
Child, str5 := StringObject,
StringFrame,
MUIA_String_Contents, pg5, End,
Child, str6 := StringObject,
StringFrame,
MUIA_String_Contents, pg6, End,
Child, str7 := StringObject,
StringFrame,
MUIA_String_Contents, pg7, End,
Child, str8 := StringObject,
StringFrame,
MUIA_String_Contents, pg8, End,
Child, str9 := StringObject,
StringFrame,
MUIA_String_Contents, pg9, End,
End,
Child, VGroup,
MUIA_FrameTitle, 'Cli command to RUN the App',
Child , pop1 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg1p, 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,
Child , pop2 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg2p , 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,Child , pop3 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg3p , 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,Child , pop4 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg4p , 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,Child , pop5 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg5p , 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,Child , pop6 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg6p , 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,Child , pop7 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg7p , 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,Child , pop8 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg8p , 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,Child , pop9 := PopaslObject ,
MUIA_Popasl_Type , 0 ,
MUIA_Popstring_String , StringMUI( pg9p , 80 ),
MUIA_Popstring_Button , PopButton( MUII_PopFile ),
End,
End,
End,
Child, HGroup,
Child, btsave:= SimpleButton('Save'),
Child, btuse:= SimpleButton('Use'),
Child, btcancel:= SimpleButton('Cancel'),
End,
End,
End,
End
IF (app=NIL) THEN
Raise('Failed to create Application.')
/*
** Install notification events...
*/
doMethod(wi_label_0, [MUIM_Notify, MUIA_Window_CloseRequest, MUI_TRUE, app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit,MUI_TRUE])
doMethod(btcancel, [MUIM_Notify, MUIA_Pressed, MUI_TRUE, app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit,MUI_TRUE])
doMethod(btsave, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_SAVEPREFS,MUI_TRUE])
doMethod(btuse, [MUIM_Notify, MUIA_Pressed, MUI_TRUE,app, 2,MUIM_Application_ReturnID,ID_USEPREFS,MUI_TRUE])
/*
** This is the ideal input loop for an object oriented MUI application.
** Everything is encapsulated in classes, no return ids need to be used,
** we just check if the program shall terminate.
** Note that MUIM_Application_NewInput expects sigs to contain the result
** from Wait() (or 0). This makes the input loop significantly faster.
*/
set(wi_label_0,MUIA_Window_Open,MUI_TRUE)
running := TRUE /* Not for MUI -> no need to use MUI_TRUE */
WHILE running
result := doMethod(app, [MUIM_Application_Input, {sigs} ])
SELECT result
CASE MUIV_Application_ReturnID_Quit
running := FALSE
CASE ID_SAVEPREFS
savednprefs()
CASE ID_USEPREFS
usednprefs()
ENDSELECT
IF sigs THEN sigs:=Wait(sigs)
ENDWHILE
set(wi_label_0,MUIA_Window_Open,FALSE)
/*
** Shut down...
*/
EXCEPT DO
IF app THEN Mui_DisposeObject(app)
IF muimasterbase THEN CloseLibrary(muimasterbase)
IF exception THEN WriteF('\s\n',exception)
ENDPROC
PROC doMethod( obj:PTR TO object, msg:PTR TO msg )
DEF h:PTR TO hook, o:PTR TO object, dispatcher
IF obj
o := obj-SIZEOF object /* instance data is to negative offset */
h := o.class
dispatcher := h.entry /* get dispatcher from hook in iclass */
MOVEA.L h,A0
MOVEA.L msg,A1
MOVEA.L obj,A2 /* probably should use CallHookPkt, but the */
MOVEA.L dispatcher,A3 /* original code (doMethod()) doesn't. */
JSR (A3) /* call classDispatcher() */
MOVE.L D0,o
RETURN o
ENDIF
ENDPROC NIL
/* End of DockNet */
PROC savednprefs()
DEF filesave,filesaveenv,st1c,st2c,st3c,st4c,st5c,st6c,st7c,st8c,st9c,pop1c,pop2c,pop3c,pop4c,pop5c,pop6c,pop7c,pop8c,pop9c
get(str1, MUIA_String_Contents, {st1c} )
get(str2, MUIA_String_Contents, {st2c} )
get(str3, MUIA_String_Contents, {st3c} )
get(str4, MUIA_String_Contents, {st4c} )
get(str5, MUIA_String_Contents, {st5c} )
get(str6, MUIA_String_Contents, {st6c} )
get(str7, MUIA_String_Contents, {st7c} )
get(str8, MUIA_String_Contents, {st8c} )
get(str9, MUIA_String_Contents, {st9c} )
get(pop1, MUIA_String_Contents, {pop1c} )
get(pop2, MUIA_String_Contents, {pop2c} )
get(pop3, MUIA_String_Contents, {pop3c} )
get(pop4, MUIA_String_Contents, {pop4c} )
get(pop5, MUIA_String_Contents, {pop5c} )
get(pop6, MUIA_String_Contents, {pop6c} )
get(pop7, MUIA_String_Contents, {pop7c} )
get(pop8, MUIA_String_Contents, {pop8c} )
get(pop9, MUIA_String_Contents, {pop9c} )
filesave:=Open('Envarc:DockNet/Docknet.prefs', NEWFILE)
SetStdOut(filesave)
WriteF('\s\n',st1c)
WriteF('\s\n',pop1c)
WriteF('\s\n',st2c)
WriteF('\s\n',pop2c)
WriteF('\s\n',st3c)
WriteF('\s\n',pop3c)
WriteF('\s\n',st4c)
WriteF('\s\n',pop4c)
WriteF('\s\n',st5c)
WriteF('\s\n',pop5c)
WriteF('\s\n',st6c)
WriteF('\s\n',pop6c)
WriteF('\s\n',st7c)
WriteF('\s\n',pop7c)
WriteF('\s\n',st8c)
WriteF('\s\n',pop8c)
WriteF('\s\n',st9c)
WriteF('\s\n',pop9c)
Close(filesave)
filesaveenv:=Open('Env:DockNet/Docknet.prefs', NEWFILE)
SetStdOut(filesaveenv)
WriteF('\s\n',st1c)
WriteF('\s\n',pop1c)
WriteF('\s\n',st2c)
WriteF('\s\n',pop2c)
WriteF('\s\n',st3c)
WriteF('\s\n',pop3c)
WriteF('\s\n',st4c)
WriteF('\s\n',pop4c)
WriteF('\s\n',st5c)
WriteF('\s\n',pop5c)
WriteF('\s\n',st6c)
WriteF('\s\n',pop6c)
WriteF('\s\n',st7c)
WriteF('\s\n',pop7c)
WriteF('\s\n',st8c)
WriteF('\s\n',pop8c)
WriteF('\s\n',st9c)
WriteF('\s\n',pop9c)
Close(filesaveenv)
SetStdOut(stdin)
Mui_RequestA(app, wi_label_0, 0, NIL, 'OK', 'Prefs Saved ',NIL)
ENDPROC
PROC usednprefs()
DEF filesaveenv,st1c,st2c,st3c,st4c,st5c,st6c,st7c,st8c,st9c,pop1c,pop2c,pop3c,pop4c,pop5c,pop6c,pop7c,pop8c,pop9c
filesaveenv:=Open('Env:DockNet/Docknet.prefs', NEWFILE)
SetStdOut(filesaveenv)
WriteF('\s\n',st1c)
WriteF('\s\n',pop1c)
WriteF('\s\n',st2c)
WriteF('\s\n',pop2c)
WriteF('\s\n',st3c)
WriteF('\s\n',pop3c)
WriteF('\s\n',st4c)
WriteF('\s\n',pop4c)
WriteF('\s\n',st5c)
WriteF('\s\n',pop5c)
WriteF('\s\n',st6c)
WriteF('\s\n',pop6c)
WriteF('\s\n',st7c)
WriteF('\s\n',pop7c)
WriteF('\s\n',st8c)
WriteF('\s\n',pop8c)
WriteF('\s\n',st9c)
WriteF('\s\n',pop9c)
Close(filesaveenv)
SetStdOut(stdin)
Mui_RequestA(app, wi_label_0, 0, NIL, 'OK', 'Prefs Saved on Env: ',NIL)
ENDPROC